package com.zyd.blog.homeart.enums;

/**
 *  业务返回
 * @author  jason
 * @date 2019/12/3
 */
public enum ServiceCodeEnum {
    SUCCESS(0, "操作成功"),
    ERROR(1, "操作失败"),
    PARAM_ERROR(2,"参数错误"),
    DATA_ERROR(3,"服务异常");
    private int code;
    private String msg;
    ServiceCodeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public static String getName(int index) {
        for (ServiceCodeEnum c : values()) {
            if (c.getCode() == index) {
                return c.msg;
            }
        }
        return null;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
